<template>
	<view>
		<view class="recurit p0-8" v-for="(item ,index) in dataInfo" :key="index">
			<uni-section :title="item.title" titleFontSize="30rpx" :sub-title="item.city+'·'+item.areas+' | '+item.experience+' | '+item.education" padding="0 0 5px 10px">
				<view class="text-right p8-0">
					<uni-tag @click="onLink('/user/recruit/form',item.id)" :inverted="true" text="编辑" class="mr15" />
					<uni-tag @click="onLink('/user/recruit/receive_resume',item.id)" :inverted="true" :text="'已收简历 '+item.delivery" type="warning" />
				</view>
				<template v-slot:right><view class="red"><b>{{item.salary}}/{{item.salary_type}}</b></view></template>
			</uni-section>
		</view>
		
		<view class="fixed-bottom mb-15">
			<view class="p0-15"><button class="default-button" @click="onLink('/user/recruit/form',0)">发布新职位</button></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{},
				status:'more',
				dataInfo:[]
			}
		},
		onShow() {
			this.onGetData()
			// https://adminapi.xinzhuvip.com/api/applet_api/recruit_company_info
			// https://adminapi.xinzhuvip.com/api/applet_api/recruit
			// https://adminapi.xinzhuvip.com/api/applet_api/recruit_delete
			// recruit_edit
			// recruit_columns
			// 'https://adminapi.xinzhuvip.com/api/applet_api/recruit_info/' + this.data.id;
		},
		methods: {
			onGetData(){
				let _this = this
				this.$request_api('applet_api/recruit','POST',this.form).then(res => {
					_this.dataInfo = res.data
					_this.dataInfo.forEach((e) => {
						e.education = _this.$func.edu[e.education]
						e.experience = _this.$func.exp[e.experience]
						e.salary = e.salary_type == 2 ? _this.$func.month_wages[e.salary] : _this.$func.year_wages[e.salary]
						e.salary_type = e.salary_type == 2 ? '月' : '年'
					})
					
				}).catch(err => {
					console.log(err)
				})
			},
			onLink(url,id){
				uni.navigateTo({
					url: url+"?id="+id
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.img{width: 60%;height: 60px;}
	.head-image{border-radius: 50%;}
	.user-image{width: 60px;height: 60px;border-radius: 60px;}
	.brief{font-size: .6rem;}
	.recurit{border-bottom: 1px solid #EEE;}
	.logo{width: 50px;height: 50px;border:1px solid #EEE;border-radius: 3px;}
	.company-title{height: 30px;}
</style>
